package com.briup.cms.web.controller;

import com.briup.cms.bean.Config;
import com.briup.cms.service.IConfigService;
import com.briup.cms.utils.Message;
import com.briup.cms.utils.MessageUtil;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RequestMapping
@RestController("/config")
@Api(description = "配置接口")
public class ConfigController {
    @Autowired
    private IConfigService configService;
    @ApiOperation("查询所有")
    @GetMapping("findAll")
    public Message findAll(){
        List<Config> list=configService.findAll();
        return MessageUtil.success(list);
    }
    @ApiOperation("保存或更新")
    @GetMapping("saveOrUpdate")
    public Message saveOrUpdate(Config config){
        configService.saveOrUpdate(config);
        return MessageUtil.success(config);
    }




    @ApiOperation("删除操作")
    @GetMapping("deleteById")
    public Message deleteById(Long id){
        configService.deleteById(id);
        return MessageUtil.success(id);
    }



}
